package jmu.edu.yjc.domain.entity.neo4j.NodeEntity;

import io.swagger.annotations.ApiModel;
import jmu.edu.yjc.domain.entity.neo4j.RelationEntity.DrugOf;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.neo4j.core.schema.*;

import java.util.Objects;
import java.util.List;
import java.util.Set;

@Node("producer")
@Data
@Builder
@ApiModel("在售药品")
@AllArgsConstructor
@NoArgsConstructor
public class Producer {
    @Id
    @GeneratedValue
    private Long id;
    @Property("name")
    private String name;
    @Relationship(type = "drug_of" , direction = Relationship.Direction.OUTGOING)
    private Set<DrugOf> drugOf;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Producer)) return false;
        Producer producer = (Producer) o;
        return Objects.equals(name, producer.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }
}
